import axios from 'axios'

/*axios默认配置*/
//axios.defaults.baseURL = 'http://192.168.1.77:8080';//设置URL
// 144服务器   amgen   BayerData   roche
axios.defaults.baseURL = 'http://47.104.167.144/roche';
axios.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8';//设置请求头
axios.defaults.timeout = 10000;//设置请求超时

function httpGet(port) {
  return new Promise((resolve, reject) => {
    axios.get(port).then((response) => {
      resolve(response)
    }).catch((error) => {
      reject(error);
    })
  })
}

function httpPost(port, data) {
  return new Promise((resolve, reject) => {
    axios.post(port, data).then((response) => {
      resolve(response)
    }).catch((error) => {
      reject(error);
    })
  })
}

export default {
  httpGet,
  httpPost,
};
